
function recur(l: TreeNode | null, r: TreeNode | null): boolean {
    if (l == null && r == null) {
        return true;
    }
    if ((l == null || r == null) || l.val != r.val) {
        return false;
    }

    return recur(l?.left, r?.right) && recur(l?.right, r?.left);
}

function isSymmetric_recur(root: TreeNode | null): boolean {
    if (root == null) {
        return true;
    }

    return recur(root.left, root.right);
};

